package com.gmft.tablemanager;
/**
 *
 * @author Jonathan Tintinger
 * @version Alpha
 * BUILD AND CONTROL TABLE MANAGER FOR GOOGLE MAPS FUSION TABLES (tm)
 * This program allows the reading, adding, editing and creating of 
 * Fusion Table
 * 
 * 
 * All authentication is stored in a file credential.clf
 * The file is structured to include the following:
 * googleloginname@gmail.com
 * passwordforgmailac
 */

public class Example 
{
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) 
    {   
        /*
        //SET PROXY
        String host="proxyss.wits.ac.za";
        String port= "80";     
        //System.setProperty("java.net.useSystemProxies", "true");     
        System.setProperty("http.proxyHost", host);
        System.setProperty("http.proxyPort", port);
        System.setProperty("http.proxySet",  "true");
        System.setProperty("https.proxyHost", host);
        System.setProperty("https.proxyPort", port);
        System.setProperty("https.proxySet",  "true");
        */
        
                
        String cFile="credential.clf";        
        //String sqlQry="null";
            
        //Encrypted tableID for TestGrid.csv
        //String tableID_enc="1d3QfWHpGhmq_-oAeDwUmwvVj3XQGDFJD5BNk5hA";
        String tableID_enc="1Fa37L3pF1mEsNObjf6BRBbnAgP8_6HUmEyPkXCU";
        
              
        //GoogleFusionTableDB gft=new GoogleFusionTableDB(cFile);
        TeamDisplayHandler dispH = new TeamDisplayHandler(tableID_enc);
        if (dispH.authenticate(cFile))//if authenticated
        {
            boolean valueChanged=dispH.blockSetTeam(2, 1, "Destroyed");
            if (valueChanged==true)
                System.out.println("UPDATED");
        }
        
        
        
        
        //String gridID="100-89";
        //sqlQry="SELECT ROWID FROM " + tableID_enc + " WHERE GridID = '100-89'";     
        //String rowID=gft.extractRowID(tableID_enc,gridID);        
        //System.out.println(rowID);             
               
        //GridSQLGen sqlGen=new GridSQLGen(tableID_enc);
        //sqlQry=sqlGen.blockSetTeam(rowID, "Resource");
       
        //System.out.println(sqlQry);
        //Execute Query with encrypted Table ID
        //gft.execQuery(sqlQry,true);
        
        
        
    }
}
